<script >
import { ElMessageBox } from 'element-plus'
import title1 from "../components/title.vue";
import Navigation from "../components/navigation_stu.vue";
export default{
  name: 'stu_grade',
  components:{
    title1,
    Navigation
  },
  data(){
    return{
      sel_cyear:'',
      cyear
    }
  },
  methods:{
    mes(){
      ElMessageBox.alert('此内容不是课程需求，开发ing~', '提示', {
      // if you want to disable its autofocus
      // autofocus: false,
      confirmButtonText: 'OK',
    })
  }
},
  mounted() {
    document.title = '学生信息管理系统';
    const token = localStorage.getItem('token'); // 确保 token 已正确存储
    const userNo = sessionStorage.getItem('UserNo'); // 确保 UserNo 已正确存储
    if (!token || !userNo) {
      alert('缺少必要的认证信息，请重新登录。');
      this.$router.push({ name: "Login" });
    }
  },
};

const cyear = [
  {
    value: '24秋',
    label: '24秋',
  },
  {
    value: '24春',
    label: '24春',
  },
  {
    value: '23秋',
    label: '23秋',
  },
  {
    value: '23春',
    label: '23春',
  },
  {
    value: '22秋',
    label: '22秋',
  },
  {
    value: '22春',
    label: '22春',
  },
];

</script>

<template>
  <text class="sub-title"> — 查询课程成绩</text>
  <title1></title1>
  <Navigation></Navigation>
  <el-container style="position: fixed;top: 120px;left: 500px;">
    <el-text style="margin-left: 30px">所查课程学年学期:</el-text>
    <el-tree-select
        v-model="sel_cyear"
        :data="cyear"
        :render-after-expand="false"
        style="width: 180px;margin-left: 10px"
    />
    <el-button plain @click="mes" style="margin-left: 50px">
      查询
    </el-button>
  </el-container>
  <el-table :data="tableData"  class="xktable" border style=" width: 75%">
    <el-table-column
        type="index"
        label="序号"
        width="70"
        align="center"
    ></el-table-column>
    <el-table-column
        prop="cno"
        label="课程号"
        min-width="80px"
        align="center"
        :show-overflow-tooltip="true"
    ></el-table-column>
    <el-table-column
        prop="cname"
        label="课程名"
        min-width="80px"
        align="center"
        :show-overflow-tooltip="true"
    ></el-table-column>
    <el-table-column
        prop="ccredit"
        label="学分"
        min-width="80px"
        align="center"
        :show-overflow-tooltip="true"
    ></el-table-column>
    <el-table-column
        prop="ctea"
        label="授课教师"
        min-width="100px"
        align="center"
        :show-overflow-tooltip="true"
    ></el-table-column>
    <!--ctl:时间time和地点location-->
    <el-table-column
        prop="cgrade"
        label="成绩"
        min-width="120px"
        align="center"
        :show-overflow-tooltip="true"
    ></el-table-column>
  </el-table>
</template>

<style scoped>
.sub-title{
  z-index: 2;
  position: fixed;
  top: 35px;
  left: 380px;
  color: #0e4bbd;
  font-size: 30px;
  font-weight: normal;
}
.xktable{
  position: fixed;
  top: 200px;
  left: 280px;
}
</style>